package com.yst.feign2.controller;

import com.yst.feign2.common.ApiResponse;
import com.yst.feign2.config.HttpResult;
import com.yst.feign2.vo.TestVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;

@Slf4j
@RestController
@RequestMapping("demo")
public class UserController {

//    @GetMapping("throwException")
    public TestVO throwException() {
        log.info("feign2 调用成功");
        throw new RuntimeException("用户不存在");
    }

    @GetMapping("hello")
    public ApiResponse<TestVO> hello() {
        TestVO vo = new TestVO("hello", 18, LocalDateTime.now(), new Date(), new BigDecimal(100));
        log.info("feign2 调用成功");
        return new ApiResponse<>(vo);
    }
}
